package com.rms.server.Service;

import com.rms.server.Dao.DishMapper;
import com.rms.server.Domain.Dish;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;
@Service
public class DishService {
    @Autowired
    private DishMapper dishMapper;

    public int addDish(Dish dish) {
        return dishMapper.insertDish(dish);
    }

    public int removeDish(Long dishId) {
        return dishMapper.deleteDish(dishId);
    }

    public int modifyDish(Dish dish) {
        return dishMapper.updateDish(dish);
    }

    public Dish getDishById(Long dishId) {
        return dishMapper.selectDishById(dishId);
    }

    public List<Dish> getAllDishes() {
        return dishMapper.selectAllDishes();
    }
    // 获取今日菜品（随机8个菜品）
    public List<Dish> getRandomDishes() {
        return dishMapper.getRandomDishes();
    }
}
